import { tokenType } from '@/types/data';
const geekToken = 'geek-90-token';
// 存储token
export const setToken = (token: tokenType) => {
  localStorage.setItem(geekToken, JSON.stringify(token));
};

// 获取token
export const getToken = (): tokenType => {
  return JSON.parse(localStorage.getItem(geekToken) || '{}');
};

// 清空token
export const clearToken = () => {
  localStorage.removeItem(geekToken);
};

// 是否有token
export const hasToken = (): boolean => {
  return !!getToken().refresh_token;
};
